﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using IBLL;

namespace BLL
{
    public class SearchBLL:ISearchBLL
    {
        public List<Model.UserInfo> searchUser(string keyWord)
        {
            List<Model.UserInfo> userlist = new List<Model.UserInfo>();
            DAL.UserInfoDAL userInfo = (DAL.UserInfoDAL)DALFAC.DataAccess.CreateUserInfo();
            if (userInfo != null)
            {
                if (userInfo.userExistByName(keyWord))
                {
                    userlist = userInfo.userNameInfoList(keyWord);
                } 
                
            }

            return userlist;
        }

        public List<Model.Album> searchAlbum(string keyWord)
        {
            List<Model.Album> albumlist = new List<Model.Album>();
            DAL.AlbumDAL albumDal = (DAL.AlbumDAL)DALFAC.DataAccess.CreateAlbum();
            if (albumDal != null)
            {
                if (albumDal.albumNameExists(keyWord))
                {
                    albumlist = albumDal.GetListByName(keyWord);
                }

            }

            return albumlist;
        }


        public List<Model.Photo> searchPhoto(string keyWord)
        {
            List<Model.Photo> photolist = new List<Model.Photo>();
            DAL.PhotoDAL photoDal = (DAL.PhotoDAL)DALFAC.DataAccess.CreatePhoto();
            if (photoDal != null)
            {              
                    photolist = photoDal.getListByImp(keyWord);
                
            }

            return photolist;
        }
    }
}
